<?php ob_start();if(!isset($_SESSION)){
session_start();
}
require_once('Connections/microassur.php');require_once('utils/fonctions.php');  ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}



/*$colname_rs_pers = "-1";
if (isset($_GET['Identifiant_personne'])) {
  $colname_rs_pers = $_GET['Identifiant_personne'];
}*/

mysql_select_db($database_microassur, $microassur);
$query_rs = "SELECT * FROM referenceexterne where Identifiant_contrat='".$_SESSION['idcontrat']."'";
$rs = mysql_query($query_rs, $microassur) or die(mysql_error());
$row_rs = mysql_fetch_assoc($rs);
$totalRows_rs = mysql_num_rows($rs);


mysql_select_db($database_microassur, $microassur);
$query_rs_pers = sprintf("SELECT * FROM personne WHERE Identifiant_personne = %s", GetSQLValueString($colname_rs_pers, "int"));
$rs_pers = mysql_query($query_rs_pers, $microassur) or die(mysql_error());
$row_rs_pers = mysql_fetch_assoc($rs_pers);
$totalRows_rs_pers = mysql_num_rows($rs_pers);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Références externes</title>
<link rel="stylesheet" type="text/css" href="../../../../css/main.css" />
            <link rel="stylesheet" type="text/css" href="list.css" />
			<!--[if IE 7]>
            	<link rel="stylesheet" type="text/css" href="../../../../css/ie7.css" />
            	<link rel="stylesheet" type="text/css" href="form_ie7.css" />
            <![endif]-->
            
			<script language="Javascript">
            <!--
                function modifier(choix){
                    var modifAct = document.getElementById("modifAct");
					var suppAct = document.getElementById("suppAct");
        modifAct.href = 'saisierefexterne.php?Identifiant_personne=<?php echo $row_rs_pers['Identifiant_personne']; ?>&Identifiant_refext=' + choix ;
        suppAct.href = 'saisierefexterne.php?Identifiant_personne=<?php echo $row_rs_pers['Identifiant_personne']; ?>&Identifiant_refext=' + choix + '&supp=1' ;
                }
            //-->
            </script></head>

<body>
<div id="sf_menu1">
	<h3>Production <?php //echo nomPersonne($database_microassur, $microassur, $_GET['Identifiant_personne']) ?></h3>

<?php
	//if(isset($_GET['message']) && $_GET['msg']=='message')
		//$message = colorer("Référence externe supprimée.","false");

	if(isset($message) && !empty($message)){
		echo $message;
	}
	$nommodule="Référence externe";
	$nommodule2="Liste référence";
	//$nom_module_saisie="Ecran saisie";
?>
</div>
<div class="cleared"></div>

<div class="corps1">
<!--/***************************************/-->
	<div class="imgleft"></div>
	<div class="imgmiddle">
		<div class="btn">
        	<span class="btnleft"></span>
            <span class="btnmiddle">
            	<h5><?php echo $nommodule; ?></h5>
            </span><span class="btnright"></span>
        </div>
		<div class="btn1">
        	<span class="btnleft"></span>
            <span class="btnmiddle">
            	<h5><?php echo $nommodule2; ?></h5>
            </span><span class="btnright"></span>
        </div>
		<div class="cleared"></div>
<table class="tab_liste">
  <tr id="niv1">
  <td class="td1">&nbsp;</td>
  <td class="td2">TYPE</td>
  <td class="td3">VALEUR</td>
  </tr>
</table>
  <div class="content_table bright">
  <table class="tab_list">
   <?php $i=1; if($totalRows_rs>0){ do { ?>
    <tr <?php if($i%2==0) echo 'class="colorligne"'; ?>>
   <td class="td1">
      	<input onClick="modifier(this.value);" type="radio" name="choix" id="choix" value="<?php echo $row_rs['Identifiant_refext']; ?>" />
      </td>
        <td class="td2"><?php echo $row_rs['Type_refext']; ?></td>
      <td class="td3"><?php echo $row_rs['Valeur_refext']; ?></td>
       </tr>
    <?php $i++; } while ($row_rs = mysql_fetch_assoc($rs)); }?>   
</table>
</div>
						<div id="buttonright"><a href="saisierefexterne.php?Identifiant_personne=<?php echo $row_rs_pers['Identifiant_personne']; ?>"><span class="btleft"></span><span class="btmiddle">Créer</span><span class="btright"></span></a></div>
						<div id="buttonright"><a id="modifAct" href="#"><span class="btleft"></span><span class="btmiddle">Modifier</span><span class="btright"></span></a></div>
					
	
	</div>
	<div class="imgright"></div>
    <div class="bt1">
	<a href="../../contrat/index.php">
    	<span class="btleft"></span>
        <span class="btmiddle">Retour</span>
        <span class="btright"></span>
    </a>
</div>
	<div class="cleared"></div>
	<!--/***************************************/-->


</div>
</body>
</html>
<?php
mysql_free_result($rs);

mysql_free_result($rs_pers);
?>
